<template>
    <div class="box">
   <van-form style="margin-top:200px">
    <!-- @submit="onSubmit" -->
  <van-cell-group inset>
    <van-field
      v-model="username"
      name="用户名"
      label="用户名"
      placeholder="用户名"
      :rules="[{ required: true, message: '请填写用户名' }]"
      label-height="40px"
    />
    <van-field
      v-model="password"
      type="password"
      name="密码"
      label="密码"
      placeholder="密码"
      :rules="[{ required: true, message: '请填写密码' }]"
    />
  </van-cell-group>
  <div style="margin: 16px;">
    <van-button round block type="primary"  @click="reslogain">
     登录
    </van-button>
  </div>
</van-form>
</div>
  </template>
  <script>
  import {logain} from '@/request/api/music'
  export default{
     data() {
        return {
            username:'',
            password:''
        }
     },
     methods:{
     reslogain()
     {
       logain(this.username,this.password).then(res=>{
        console.log(res)
        if(res.data.code==200)
        {
            sessionStorage.setItem('token',JSON.stringify(res.data.token))
            sessionStorage.setItem('profile',JSON.stringify(res.data.profile))
            this.$store.commit('bjbottomshow',true)
            this.$router.push('/personal')
        }
       })
     }
  },
}
  </script>
  <style lang="less" scoped>
  .box{
   height: 100vh;
   width: 100%;	/* 重点一 */
   background-image: url(@/assets/02.jpg);
   background-repeat: no-repeat;
   background-size: cover; /* 重点二 */
   overflow: auto;
  }
.van-field__label{
    height: 30px;
    line-height: 30px;
}
 .van-field__control{
        height: 30px;
    line-height: 30px;
    }
  </style>
  